package com.salas.entity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.GeneratedValue;
import javax.persistence.OneToMany;
import javax.persistence.Version;
import org.hibernate.validator.Length;

@Entity
public class Attribute implements Serializable {
	
	private int id;
	private String name;
	private List<Value> values = new ArrayList<Value>();
	
	
	@Id @GeneratedValue
	@Column(name = "attribute_id")
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}
  	
	
	@Length(max=20)
	@Column(name = "attribute_name", unique = true, nullable = false)
	public String getName() {
	     return name;
	}

	public void setName(String name) {
	     this.name = name;
	}
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "attribute")
	public List<Value> getValues() {
		return values;
	}

	public void setValues(List<Value> values) {
		this.values = values;
	}

   	
}
